/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package team.com.demo;
import java.net.InetAddress;
/**
 *
 * @author 李惠来（LiHuilai）<a href="http://blog.csdn.net/im1046061426">CSDN博客</a>
 * 邮箱：huilai475@163.com QQ：1046061426
 */
public class OnlineUser {
    private String hostname;
    private String nickname;
    private InetAddress inetAddress;
    

    public OnlineUser(String hostname,InetAddress inetAddress){
        this.hostname=hostname;
        this.nickname="null";
        this.inetAddress=inetAddress;
    }
    public OnlineUser(String hostname,String nickname,InetAddress inetAddress){
        this.hostname=hostname;
        this.nickname=nickname;
        this.inetAddress=inetAddress;
    }
    public String getNickname(){
        return this.nickname;
    }
    public InetAddress getInetAddress(){
        return this.inetAddress;
    }
    public String show(){
        String show;
        if (nickname.equals("null")){
                show=this.hostname;
            show=hostname+"("+inetAddress.getHostAddress()+")";
        }else{
            show=nickname+"("+inetAddress.getHostAddress()+")";
        }            
        return show;        
    }
    public boolean equals(OnlineUser onlineUser){
        if (this.inetAddress.equals(onlineUser.inetAddress)){
            return true;
        }
        return false;
    }
}
